Allow parallel 32- and 64-bit Xen installations. Move xc_save, xc_restore,
authoremellor@ewan <emellor@ewan>
Tue, 11 Oct 2005 13:55:12 +0000 (14:55 +0100)
committeremellor@ewan <emellor@ewan>
Tue, 11 Oct 2005 13:55:12 +0000 (14:55 +0100)
and xenconsole out of /usr/libexec/xen and into one of /usr/lib/xen/bin or
/usr/lib64/xen/bin.  Remove all the PATH hacking inside Xend, and rely upon
the PATH being set correctly from outside.  Added an auxbin module for
handling the hacky stuff.

Replace the few /usr/bin/python bang paths with /usr/bin/env python.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
Makefile
tools/console/Makefile
tools/misc/xend
tools/python/xen/util/Brctl.py
tools/python/xen/xend/XendCheckpoint.py
tools/python/xen/xend/server/SrvDaemon.py
tools/python/xen/xend/sxp.py
tools/python/xen/xm/create.py
tools/python/xen/xm/main.py
tools/xcutils/Makefile

index 7b513c620924edc1f62a35363d01b725ada8cb04..f38479b2d3a76d5485b433f7a8dea11749c1ef4f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -179,7 +179,7 @@ uninstall:
        rm -rf $(D)/usr/$(LIBDIR)/libxenctrl* $(D)/usr/$(LIBDIR)/libxenguest*
        rm -rf $(D)/usr/$(LIBDIR)/libxenstore*
        rm -rf $(D)/usr/$(LIBDIR)/python/xen $(D)/usr/$(LIBDIR)/xen 
-       rm -rf $(D)/usr/libexec/xen
+       rm -rf $(D)/usr/$(LIBDIR)/xen/bin
        rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm
        rm -rf $(D)/usr/share/doc/xen
        rm -rf $(D)/usr/share/xen
index 3e1471d99c68f820a9331110345c36da470c1489..a27aa8e458e1026363ad094fab8074936bfe6117 100644 (file)
@@ -3,7 +3,7 @@ XEN_ROOT=../..
 include $(XEN_ROOT)/tools/Rules.mk
 
 DAEMON_INSTALL_DIR = /usr/sbin
-CLIENT_INSTALL_DIR = /usr/libexec/xen
+CLIENT_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
 
 INSTALL         = install
 INSTALL_PROG    = $(INSTALL) -m0755
index e1a6b4f437be5faabc18e6f5f9174f21054e9808..f2db3c100b146636d0640be68080305bf1ffedf7 100644 (file)
@@ -2,9 +2,10 @@
 #  -*- mode: python; -*-
 #============================================================================
 # Copyright (C) 2004 Mike Wray <mike.wray@hp.com>
+# Copyright (C) 2005 XenSource Ltd
 #============================================================================
 
-"""Xen management daemon. Lives in /usr/sbin.
+"""Xen management daemon.
    Provides console server and HTTP management api.
 
    Run:
@@ -67,14 +68,14 @@ def check_user():
 
 def start_xenstored():
     XENSTORED_TRACE = os.getenv("XENSTORED_TRACE")
-    cmd = "/usr/sbin/xenstored --pid-file=/var/run/xenstore.pid"
+    cmd = "xenstored --pid-file=/var/run/xenstore.pid"
     if XENSTORED_TRACE:
         cmd += " -T /var/log/xenstored-trace.log"
     s,o = commands.getstatusoutput(cmd)
 
 def start_consoled():
     if os.fork() == 0:
-        os.execvp('/usr/sbin/xenconsoled', ['/usr/sbin/xenconsoled'])
+        os.execvp('xenconsoled', ['xenconsoled'])
             
 def main():
     try:
index 28506057f2a88097484cb24384e8155cee164e82..9ae8fdf51dfc0d3555f3e4a8aefdf64e87170aef 100644 (file)
@@ -5,7 +5,6 @@ import os.path
 import re
 import sys
 
-os.defpath = os.defpath + ':/sbin:/usr/sbin:/usr/local/sbin'
 CMD_IFCONFIG = 'ifconfig'
 CMD_ROUTE    = 'route'
 CMD_BRCTL    = 'brctl'
index 3d45bdb60abbcf1a4e0db6ac895891b64f6fc6ed..d8ae85b91ebfb60717496e677d1cfcdc708eb311 100644 (file)
@@ -14,6 +14,8 @@ from struct import pack, unpack, calcsize
 
 from xen.util.xpopen import xPopen3
 
+import xen.util.auxbin
+
 import xen.lowlevel.xc
 
 from xen.xend.xenstore.xsutil import IntroduceDomain
@@ -21,9 +23,11 @@ from xen.xend.xenstore.xsutil import IntroduceDomain
 from XendError import XendError
 from XendLogging import log
 
+
 SIGNATURE = "LinuxGuestRecord"
-PATH_XC_SAVE = "/usr/libexec/xen/xc_save"
-PATH_XC_RESTORE = "/usr/libexec/xen/xc_restore"
+XC_SAVE = "xc_save"
+XC_RESTORE = "xc_restore"
+
 
 sizeof_int = calcsize("i")
 sizeof_unsigned_long = calcsize("L")
@@ -64,7 +68,7 @@ def save(fd, dominfo, live):
         # enabled. Passing "0" simply uses the defaults compiled into
         # libxenguest; see the comments and/or code in xc_linux_save() for
         # more information.
-        cmd = [PATH_XC_SAVE, str(xc.handle()), str(fd),
+        cmd = [xen.util.auxbin.pathTo(XC_SAVE), str(xc.handle()), str(fd),
                str(dominfo.getDomid()), "0", "0", str(int(live)) ]
         log.debug("[xc_save]: %s", string.join(cmd))
 
@@ -129,7 +133,7 @@ def restore(xd, fd):
         store_evtchn = dominfo.store_channel
         console_evtchn = dominfo.console_channel
 
-        cmd = [PATH_XC_RESTORE, str(xc.handle()), str(fd),
+        cmd = [xen.util.auxbin.pathTo(XC_RESTORE), str(xc.handle()), str(fd),
                str(dominfo.getDomid()), str(nr_pfns),
                str(store_evtchn), str(console_evtchn)]
         log.debug("[xc_restore]: %s", string.join(cmd))
index 0248d18ab709f8c3803010ccc9a9e086a1c9a606..543502ad958c2687b847b7fabccca0f8fdf6ae80 100644 (file)
@@ -38,7 +38,7 @@ class Daemon:
         pythonex = '(?P<python>\S*python\S*)'
         cmdex = '(?P<cmd>.*)'
         procre = re.compile('^\s*' + pidex + '\s*' + pythonex + '\s*' + cmdex + '$')
-        xendre = re.compile('^/usr/sbin/xend\s*(start|restart)\s*.*$')
+        xendre = re.compile('^\S+/xend\s*(start|restart)\s*.*$')
         procs = os.popen('ps -e -o pid,args 2>/dev/null')
         for proc in procs:
             pm = procre.match(proc)
index 47c439c1d5461f977958bb8c5db3ac8a4bf8655a..88a81cdc8ad2457a18c235bc257278515fe29703 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 #============================================================================
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of version 2.1 of the GNU Lesser General Public
index a6498c72add5c95b979ab10bf6d77b6521e6a81e..5da1acc3daccd547cf2948325eff4dae2cc677d7 100644 (file)
 #============================================================================
 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com>
 # Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
+# Copyright (C) 2005 XenSource Ltd
 #============================================================================
 
 """Domain creation.
 """
 import random
+import os
+import os.path
 import string
 import sys
 import socket
@@ -36,6 +39,9 @@ from xen.util import blkif
 
 from xen.xm.opts import *
 
+import console
+
+
 gopts = Opts(use="""[options] [vars]
 
 Create a domain.
@@ -879,8 +885,7 @@ def main(argv):
 
         dom = make_domain(opts, config)
         if opts.vals.console_autoconnect:
-            cmd = "/usr/libexec/xen/xenconsole %d" % dom
-            os.execvp('/usr/libexec/xen/xenconsole', cmd.split())
+            console.execConsole(dom)
         
 if __name__ == '__main__':
     main(sys.argv)
index 615ef4ef6072a478ec96608950f38fb72276b3f0..082bdb636725c7270109b9207b8225db20fb93a1 100644 (file)
@@ -38,6 +38,8 @@ from xen.xend import PrettyPrint
 from xen.xend import sxp
 from xen.xm.opts import *
 
+import console
+
 
 shorthelp = """Usage: xm <subcommand> [args]
     Control, list, and manipulate Xen guest instances
@@ -442,12 +444,11 @@ def xm_console(args):
     from xen.xend.XendClient import server
     info = server.xend_domain(dom)
     domid = int(sxp.child_value(info, 'domid', '-1'))
-    cmd = "/usr/libexec/xen/xenconsole %d" % domid
-    os.execvp('/usr/libexec/xen/xenconsole', cmd.split())
-    console = sxp.child(info, "console")
+    console.execConsole(domid)
+
 
 def xm_top(args):
-    os.execv('/usr/sbin/xentop', ['/usr/sbin/xentop'])
+    os.execvp('xentop', ['xentop'])
 
 def xm_dmesg(args):
     
index 2a0d13b4ce5647fb10ca7689c3711266e6db2b31..b7de270e07dac8e0cfc2b81b0383f8295f356931 100644 (file)
@@ -15,7 +15,7 @@ INSTALL_DIR   = $(INSTALL) -d -m0755
 XEN_ROOT       = ../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PROGRAMS_INSTALL_DIR   = /usr/libexec/xen
+PROGRAMS_INSTALL_DIR = /usr/$(LIBDIR)/xen/bin
 
 INCLUDES += -I $(XEN_LIBXC)